<?php

/**
* 订单控制器
*/
class OrderController extends AuthController{
	
    /*订单页面
     * */
    public function index(){
    	if(!IS_POST) go('Index/index');
    	if(!isset($_SESSION['cart'])||empty($_SESSION['cart'])) go('Index/index');
		//生成订单号
		$orderNum=Cart::getOrderId();
		//订单表添加数据
		$total=$_SESSION['cart']['total'];
		$_POST['order_num']=$orderNum;
		$_POST['total']=$total;
		$model=K('Order');
		if(!$model->addOrder()) $this->error($model->error);
		$this->assign('orderData',array('orderNum'=>$orderNum,'total'=>$total));
        $this->display();
    }
	
}
    
    
?>